@echo off
set CUDA_TARGET=deviceemu
set CUDA_SDK_PATH="D:/CUDA/cudaSDK"
set LIBS=cudart.lib cutil32D.lib
set CPP_FILES=main.cpp cppIntegration_gold.cpp
set OBJ_FILES= cppIntegration.obj cppIntegration_gold.obj main.obj
set OUTPUT_FILENAME=cppIntegration.dll

echo --- CUDA (%CUDA_TARGET%) ---
call "%VS80COMNTOOLS%vsvars32.bat"
echo --- compiling ---
rem "%CUDA_BIN_PATH%\nvcc.exe" -%CUDA_TARGET% -D_DEBUG -DWIN32 -D_CONSOLE -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Wp64,/Od,/Zi,/RTC1,/MTd -I"%CUDA_INC_PATH%" -I./ -I%CUDA_SDK_PATH%/common/inc -L%CUDA_SDK_PATH%/common/lib -o %OUTPUT_FILENAME% %FILES% %LIBS%

"d:\CUDA\bin\nvcc.exe" -ccbin "D:\Microsoft Visual Studio 8\VC\bin" -%CUDA_TARGET% -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -I"d:\CUDA\include" -I./ -I"%CUDA_SDK_PATH%/common/inc" -o cppIntegration.obj cppIntegration.cu

cl /nologo /Od /I "d:\CUDA\include" /I "./" /I %CUDA_SDK_PATH%/common/inc /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_VC80_UPGRADE=0x0710" /D "_MBCS" /D "_WINDLL" /Gm /EHsc /RTC1 /MTd /Fd"vc80.pdb" /W3 /c /Wp64 /Zi /TP %CPP_FILES%

link /nologo /OUT:"%OUTPUT_FILENAME%" /INCREMENTAL:NO /LIBPATH:"%CUDA_LIB_PATH%" /LIBPATH:%CUDA_SDK_PATH%/common/lib /DLL /DEBUG /SUBSYSTEM:CONSOLE /OPT:NOICF /MACHINE:X86 %LIBS% %OBJ_FILES%
rm *.obj
rm *.pdb
rm *.idb

echo --- testing ---
rem call %OUTPUT_FILENAME%
echo TODO
echo --- %OUTPUT_FILENAME% CREATED ---
pause
